﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EntityExersize
{
    class CustomerTest
    {
        static void Main(string[] args)
        {
            CustomersManipolations.FindeCustomersPerYearOfOrderWithNative(new DateTime(1997, 10, 12));
            //CustomersManipolations.FindSalesByRegionAndPeriod("RJ", new DateTime(1996, 1, 1), new DateTime(1997, 1, 1));
            //CustomersManipolations.RecreateNorthwind();
            testDoubleConnection();

        }

        static void testDoubleConnection() 
        {
            Northwind entities = new Northwind();
            Northwind ent2 = new Northwind();
            Product pr = entities.Products.FirstOrDefault(p => p.ProductID == 1);
            entities.DeleteObject(pr);
            Product pr2 = ent2.Products.FirstOrDefault(p => p.ProductID == 1);
            ent2.DeleteObject(pr2);
            try
            {
                entities.SaveChanges();
                ent2.SaveChanges();
            }
            catch (Exception e) 
            {
                Console.WriteLine(e.InnerException.Message);
            }
        }
    }
}
